/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2006                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions          [0 0 0 1 0 0 0];

internalField       uniform 371;

boundaryField
{
    left
    {
        type            externalWallHeatFluxTemperature;
        mode            coefficient;
        Ta              constant 300.0;
        h
        {
            type        coded;

            codeInclude
            #{
                #include "volFields.H"
            #};

            code
            #{
                const auto& T =
                    patch_.boundaryMesh().mesh()
                        .lookupObject<volScalarField>("T");

                auto thtc = tmp<scalarField>::New(patch_.size(), 300.0);
                auto& htc = thtc.ref();

                const scalarField Tp(T.boundaryField()[patch_.index()]);

                forAll(htc, facei)
                {
                    if (Tp[facei] >= 1000.0)
                    {
                        htc[facei] = 800;
                    }
                    else if (Tp[facei] >= 600.0)
                    {
                        htc[facei] = 0.2*Tp[facei]+200;
                    }
                }

                return thtc;
            #};
        }
        kappaMethod     fluidThermo;
        value           $internalField;
    }
    right
    {
        type            zeroGradient;
        value           $internalField;
    }
    bottom
    {
        type            externalWallHeatFluxTemperature;
        mode            flux;
        q               uniform  18.5e3;
        kappaMethod     fluidThermo;
        value           $internalField;
    }
    top
    {
        type            inletOutlet;
        value           uniform 371;
        inletValue      uniform 371;
    }
    frontAndBack
    {
        type            zeroGradient;
        value           $internalField;
    }
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
